package LearnAbstractClass;

public class Main {
    public static void main(String[] args) {
        Income[] incomes = new Income[] {
            new Salary(6000),
            new Royalties(4500)
        };
        System.out.println(getTotalTax(incomes));
    }

    static double getTotalTax(Income... incomes) {
        double total = 0;
        for (Income income : incomes) {
            total += income.getTax();
        }
        return total;
    }
}
